package com.ikun.search.controller;

import com.ikun.common.entity.Position;
import com.ikun.search.service.PositionService;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.List;

/**
 * 医生职位表 前端控制器
 *
 * @author Guio
 * @since 2024-02-26
 */
@RestController
@RequestMapping("search")
public class PositionController {

    @Resource
    private PositionService positionService;

    /**
     * 查所有职位
     */
    @GetMapping("all-position")
    public ResponseEntity<List<Position>> allPosition() {
        List<Position> list = new ArrayList<>();
        for (Position position : positionService.list()) {
            if (!"医士".equals(position.getPName())) {
                list.add(position);
            }
        }
        return ResponseEntity.ok(list);
    }

}
